﻿#!/usr/bin/env python3

import signal
import os

def userHandler(sig, stack):
    raise SystemExit("exit")

def main():
    '''
signal是一种异步通知手段.是unix类系统的特性之一.
linux大部分signal在windows中并没有,例如SIGUSR1.

'''
    signal.signal(signal.SIGINT, signal.SIG_IGN)
    signal.signal(signal.SIGUSR1, userHandler)
    print('PID:', os.getpid())
    signal.pause()



if __name__=='__main__':
    main()
